<script setup>
// import useUser from './store/modules/user'
// import useCount from './store/modules/count'
// const user = useUser()
// const count = useCount()
import useStore from './store'
import { storeToRefs } from 'pinia'
const { count, user } = useStore()
console.log('user', user.username)
console.log('user', user.age)
user.test()
const btnClick = () => {
  user.setUsername(Date.now())
}
//  toRefs非store数据   storeToRefs：store的数据
const { username, age } = storeToRefs(user) // {value:username的值}
console.log('storeToRefs', username)
</script>
<template>
  <div>{{ username }}</div>
  <div>{{ age }}</div>
  <div>getters访问方式：{{ user.getUserName }}</div>
  <button @click="btnClick">修改username</button>
  <hr />
  <h3>{{ count.num }}</h3>
</template>
<style></style>
